package logic

import (
	"context"
	"zy3/model/mysql"

	"zy3/zy3rpc/internal/svc"
	"zy3/zy3rpc/zy3rpc"

	"github.com/zeromicro/go-zero/core/logx"
)

type ShowLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewShowLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ShowLogic {
	return &ShowLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *ShowLogic) Show(in *zy3rpc.ShowRequest) (*zy3rpc.ShowResponse, error) {
	// todo: add your logic here and delete this line

	var user mysql.User
	mysql.DB.Debug().Model(&user).Where("id = ?", in.Id).Find(&user)

	return &zy3rpc.ShowResponse{Id: in.Id, Password: in.Password, Username: in.Username}, nil
}
